import React, { Component } from 'react';
import { observer, inject } from 'mobx-react';
import { toJS } from 'mobx';
import { Icon, Popover, Picker, Modal, Toast, Tools, Button } from 'weaver-mobile';
import { ListAdvanced, SearchAdvanced, RouteLayout ,Share} from 'weaver-mobile-page';
import { withRouter, Route } from 'react-router-dom';
import DetailPage from "../detailPage/index";
const Item = Popover.Item;
const prompt = Modal.prompt;
const getLabel = Tools.getLabel;
const color = ['#FF0000', '#FF4500'];
// let show = 'block';
const template1 = [
  {
    key: 'col1',
    configs: [
      { key: 'row1', configs: [{ key: 'icon', style: {} }] }
    ],
    style: { marginTop: '25px', flex: 'none' },
    // render() {
    //   return <div className='circleStyle'><i className="icon-coms-workflow iconLeft"></i></div>;
    // }

  },
  {
    key: 'col2',
    configs: [
      { key: 'row1', configs: [{ key: 'resourcename', style: { position: 'relative', left: '-25px', color: '#A9A9A9' } }, { key: 'adddate', style: {} }] },
      { key: 'row2', configs: [{ key: 'favname', style: { marginTop: '5px', color: '#000' }, className: 'yyyy' }] },
    ],
  },
  {
    key: 'col3',
    configs: [
      { key: 'row1', configs: [{ key: 'importbtn' }] }
    ],
    style: { position: 'absolute', top: '5px', right: '18px', padding: '1px 2px', color: '#FF0000' },
    // render() {
    //   return <div onClick={(event) => { event.stopPropagation() }}>重要</div>;
    // }

  },
]
const seasons = [
  [
    {
      label: getLabel('154', "一般"),
      value: '1',
    },
    {
      label: getLabel('25436', "关注"),
      value: '2',
    },
    {
      label: getLabel('25397', "重要"),
      value: '3',
    }
  ]
];
let solid_height = 0
@inject('CollectionListStore')
@withRouter
@observer
export default class CollectionList extends Component {
  state = {
    value: null,
    sValue: null,
    visible: false,
    str: '',
    popoverShow: false,
    newDirShow: false,
    selectedDirId: {}
  };



  componentDidMount() {
    const { CollectionListStore } = this.props;
    const { listAd, getDataT } = CollectionListStore;
    const { listViewStore, searchAdvancedStore } = listAd
    listViewStore.clearData();
    let that = this
    listAd.getData({ url: '/api/favourite/mobile/getFavouriteList', method: 'post' });
    setTimeout(function () {
      //监听滚动条变化，判断高度发生变化时，改变样式
      let Dom = document.querySelector(".favouriteList.wm-list-view-page-modal-scrollview")
      Dom && Dom.addEventListener("scroll", that.heightChange);
    }, 2000)

  }
  heightChange = () => {
    let H = document.querySelector(".list-view-section-body").offsetHeight
    if (H != solid_height) {
      solid_height = H
      this.wordlimit('yyyy')
    }
  }
  wordlimit = (cname) => {                  //参数分别为：类名，要显示的字符串长度
    var cname = document.getElementsByClassName(cname);  //需要加省略符号的元素对象
    for (var i = 0; i < cname.length; i++) {
      var nowhtml = cname[i].offsetHeight;                //元素的内容
      if (nowhtml > 84) {
        cname[i].setAttribute("class", "yyyy ellipsis");
      }else{
        cname[i].setAttribute("class", "yyyy");
      }
    }
  }
  onSearch = () => {
    const { listAd } = this.props.CollectionListStore;
    const { searchAdvancedStore, listViewStore, searchParams ,leftTreeStore} = listAd;
    let params = { ...searchParams };
    if (searchAdvancedStore) {
        const { formParams } = searchAdvancedStore.form;
        params = { ...formParams };
        if(params.dirid==""){
          leftTreeStore.selectedKeys = '';
          leftTreeStore.valueArray = [];
          leftTreeStore.valueArrayCache=[];
        }

    }
    listViewStore.clearData();
    // 带参数请求列表数据
    listAd.getData({ url: '/api/favourite/mobile/getFavouriteList', params, method: 'POST' });

  }
  toHistory = (val) => {
    val ? this.props.history.push(val) : this.props.history.go(-1);
  }
  move = (favid) => {
    const { CollectionListStore } = this.props;
    const { listAd } = CollectionListStore;
    const { listViewStore } = listAd
    console.log(listViewStore.selectedRowKeys[0] != undefined)
    if (listViewStore.selectedRowKeys[0] != undefined) {
      this.toHistory('/favouriteList/test/tree')
      this.props.CollectionListStore.mode = 'batch'
      this.props.CollectionListStore.moveSignal = true //移动信号
    } else if (favid != undefined) {
      console.log(favid)
      this.props.CollectionListStore.moveId = favid
      this.toHistory('/favouriteList/test/tree')
      this.props.CollectionListStore.mode = 'single'
      this.props.CollectionListStore.moveSignal = true //移动信号
    } else {
      Modal.alert(getLabel('390910', "请至少选择一项!"))
    }

  }
  testClick = () => {
    const { listAd } = this.props.CollectionListStore;
    const { searchAdvancedStore, listViewStore, searchParams } = listAd;
    // searchAdvancedStore.form.defaultValues.pagename.value = searchParams.favname;
    this.toHistory('/favouriteList/test/SearchAdvanced');
  }
  delete = (data) => {
    const { CollectionListStore } = this.props;
    const { listAd, showCheck, setState } = CollectionListStore;
    const { searchAdvancedStore, listViewStore, searchParams } = listAd
    if (data != undefined) {
      let options = {
        url: '/api/sysfavourite/delete',
        method: 'post',
        params: { favid: data.favid },
        type: 'json',
      }
      Modal.alert('', getLabel('390911', "删除后不可恢复，您确定删除所选记录吗？"), [
        { text: getLabel('31129', "取消"), onPress: () => Toast.info(getLabel('20114', "已取消"), 1) },
        {
          text: getLabel('826', "确定"), onPress: () => {
            listViewStore.selectNone();
            Tools.callApi(options).then((src) => {
              if (src.success == 1) {
                listViewStore.clearData();
                listAd.getData({ url: '/api/favourite/mobile/getFavouriteList', method: 'post'});
                Toast.info(getLabel('20461', "删除成功"), 1)
              } else {
                Toast.info(getLabel('25009', "失败"), 1)
              }
            })
          }
        },
      ])

    }else{
      if (showCheck) {
        if (toJS(listViewStore.selectedRowKeys).length == 0) {
          Modal.alert(getLabel('390910', "请至少选择一项!"));
        } else {
          let options = {
            url: '/api/sysfavourite/delete',
            method: 'post',
            params: { favid: [...listViewStore.selectedRowKeys] },
            type: 'json',
          }
          Modal.alert('', getLabel('390911', "删除后不可恢复，您确定删除所选记录吗？"), [
            { text: getLabel('31129', "取消"), onPress: () => Toast.info(getLabel('20114', "已取消"), 1) },
            {
              text: getLabel('826', "确定"), onPress: () => {
                Tools.callApi(options).then((src) => {
                  if (src.success == 1) {
                    Toast.info(getLabel('20461', "删除成功"), 1)
                    setState({ showCheck: false })
                    listViewStore.selectNone();
                    listViewStore.clearData();
                    listAd.getData({ url: '/api/favourite/mobile/getFavouriteList', method: 'post' });
                  } else {
                    Toast.info(getLabel('25009', "失败"), 1)
                  }
                })
              }
            },
          ])
        }

      }
    }



  }

  handleClick = () => {
    const { CollectionListStore } = this.props;
    const { listAd, moveSignal } = CollectionListStore;
    const { listViewStore, leftTreeStore } = listAd
    const { selectedKeys, treeStore } = leftTreeStore
    let operation = Modal.operation
    this.setState({ newDirShow: false })

    if (selectedKeys.length !== 0) {
      if (selectedKeys[0].replace(/^type_/, '') == -1) {
        Toast.info(getLabel('390912', "不能在该目录下新建"), 1)
        return
      }
    }

    prompt(getLabel('20002', "新建目录"), '',
      [
        {
          text: getLabel('31129', "取消"),
          onPress: value => new Promise((resolve) => {
            Toast.info(getLabel('20114', "已取消"), 1);
            setTimeout(() => {
              resolve();
            }, 1000);
          }),
        },
        {
          text: getLabel('826', "确定"),
          onPress: value => new Promise((resolve, reject) => {
            if (value == "") {
              Modal.alert('目录名称不能为空')
              return
            } else {
              Toast.info('成功', 1);
              let fatherid = ''
              if (selectedKeys[0] != undefined) {

                fatherid = selectedKeys[0]
                fatherid = fatherid.replace(/^wf_/, '')
                fatherid = fatherid.replace(/^type_/, '')

              } else {
                fatherid = ''
              }
              const options = {
                url: '/api/favourite/add',
                method: 'POST',
                params: { parentid: fatherid, favname: value },
                type: 'json',
              };
              Tools.callApi(options).then((src) => {
                if (src.success == 1) {
                  //this.add(treeStore.datas, fatherid, value, src.id)
                  let options = {
                    url: '/api/favourite/mobile/getConditions',
                    method: 'post',
                    params: { current: 1, pageSize: 20, ismobile: 1 },
                    type: 'json',
                  }
                  Tools.callApi(options).then((src) => {
                    this.props.CollectionListStore.listAd.leftTreeStore.treeStore.datas = src.treedata
                  })
                }
              });

              setTimeout(() => {
                resolve();
              }, 1000);

            }
          }),
        },
      ], 'default', null, [getLabel('129186', "请输入目录名称")])


    // Toast.info('请选择一个目录', 1)

  }

  getSwipeActionProps = () => ({
    right: [
      // {
      //   text: getLabel('6011', "转发"),
      //   onPress: (data) => {
      //     // this.toHistory('/forward')
      //     this.setShareMsgInfo(data)
      //   },
      //   className: `swipeForward`,
      // },
      {
          text: getLabel('93', "编辑"),
          onPress: (data) => {
          const { CollectionListStore } = this.props;
          const {layout } = CollectionListStore;
          this.props.CollectionListStore.moveId = data.favid
          this.props.history.push({
            pathname:layout.path,
            state:{favid:data.favid}
          })
        },
        className: `swipeEdit`,
      },
      {
        text: getLabel('78', "移动"),
        onPress: (data, event) => {
          this.move(data.favid)
        },
        className: 'swipeMove'
      }, {
        text: getLabel('91', "删除"),
        onPress: (data) => {
          this.delete(data)
        },
        className: 'swipeDelete'
      },
    ],
  })

  onLeftTreeChange = (domid, name) => {
    let _this = this
    setTimeout(() => {
    const { CollectionListStore } = _this.props;
    const { listAd, moveSignal, mode, moveId, setState, showCheck ,treeBtn} = CollectionListStore;
    const { listViewStore, leftTreeStore } = listAd
    const fileds = {};
    if (/^wf_\d+/.test(domid)) {
      fileds.dirid = { value: [{ id: domid.replace(/^wf_/, ''), name }] };
      // fileds.workflowtype = { value: [] };
    }
    if (/^type_\d+/.test(domid)) {
      fileds.dirid = { value: [{ id: domid.replace(/^type_/, ''), name }] };
      // fileds.workflowid = { value: [] };
    }
    if (/^type_-\d+/.test(domid)) {
      fileds.dirid = { value: [{ id: domid.replace(/^type_/, ''), name }] };
    }
    if (domid === '') {
      fileds.dirid = { value: [] };
      // fileds.workflowid = { value: [] };
    }
    //选中的目录同步到搜索条件中
    if (fileds.dirid.value.length !== 0) {
      _this.setState({ selectedDirId: fileds.dirid.value[0] })
    } else {
      _this.setState({ selectedDirId: {} })
    }
    if (moveSignal == true) {
      let options = {}
      //这里判断是否有选择目录
      if (treeBtn=="sure"&&fileds.dirid.value.length === 0) {
        Modal.alert(getLabel('390910', "请至少选择一项!"))
        return
      }
      options = {
        url: '/api/sysfavourite/move',
        method: 'post',
        params: { favids: mode == 'detail' ? moveId : mode == 'single' ? listViewStore.selectedRowKeys[0] || moveId : [...listViewStore.selectedRowKeys], dirid: fileds.dirid.value.length === 0 ? '' : fileds.dirid.value[0].id },
        type: 'json',
      }

      Tools.callApi(options).then((src) => {
        if (mode == 'detail') {
          const options = {
            url: '/api/favourite/mobile/getFavouriteList',
            method: 'POST',
            params: { favid: moveId, },
            type: 'json',
          };
          Tools.callApi(options).then((src) => {
            _this.props.CollectionListStore.detailData = src
            _this.props.CollectionListStore.mode = ''
          });
        } else if (mode == 'single') {
          listAd.getData({ url: '/api/favourite/mobile/getFavouriteList', method: 'post' });

        }
        //清空所选数据
        listViewStore.selectNone();
      });
    }


    // 同步树选中项到高级搜索的 from 中
    if (!listAd.searchAdvancedStore) {
      listAd.setState({
        searchAdvancedStore: new SearchAdvanced.Store({
          route: listAd.path,
          id: 'SearchAdvanced',
        }),
      });
      listAd.searchAdvancedStore.getData({
        url: '/api/workflow/reqlist/doingBaseInfo',
        method: 'POST',
      }).then((form) => {
        if (listAd.searchParams.favname) {
          fileds.favname = { value: listAd.searchParams.favname };
          form.updateFields(fileds);
          _this.onSearch();
          _this.props.CollectionListStore.moveSignal = false
        }
      });
    } else {
      let that = _this
      listAd.searchAdvancedStore.form.updateFields(fileds);
      setTimeout(function () { that.onSearch() }, 1000)

      _this.props.CollectionListStore.moveSignal = false
    }
    setState({ showCheck: false })
    }, 0);



  }
  componentWillUpdate() {
    const { CollectionListStore } = this.props;
    const { listAd,needRefresh} = CollectionListStore;
    if(needRefresh == 1){
      listAd.listViewStore.clearData();
      listAd.getData({ url: '/api/favourite/mobile/getFavouriteList', method: 'post'});
      this.props.CollectionListStore.needRefresh=0
    }
    /*let Dom = document.querySelectorAll(".am-search-synthetic-ph-placeholder")[1]

    if (Dom) {
      document.querySelectorAll(".am-search-synthetic-ph-placeholder")[1].innerHTML = "请输入搜索关键字"
    }
    let _this = this
    setTimeout(function () {
      //监听滚动条变化，判断高度发生变化时，改变样式
      let Doms = document.querySelector(".favouriteList.wm-list-view-page-modal-scrollview")
      Doms && _this.wordlimit('yyyy')
    }, 2000)*/
  }
  componentWillReceiveProps(nextPro) {
    // console.log(nextPro)
  }

  setShareMsgInfo=(data)=>{
    const { CollectionListStore } = this.props;
    const { listAd, moveSignal, mode, moveId, setState, showCheck ,treeBtn} = CollectionListStore;
    const { listViewStore, leftTreeStore } = listAd;
    const { selectedRowKeys = [] } = listViewStore;
    this.props.CollectionListStore.msgList=[];
    let title='';
    let url="";
    if(showCheck){
      selectedRowKeys.map(val=>{
        listViewStore.data.map(v=>{
            if(v.favid==val){
                title = v.favname
                url = v.url
            }
        })
        this.props.CollectionListStore.msgList.push(
            {
                content: title, // 分享标题（必填）
                sysid: window.localStorage.emobile_ec_id, // EM中添加的集成系统的ID (必填: 按照demo给的传)
                linkurl: '/api/common/chatResource/addshare', // 消息链接地址（必填）
                canforward: 1, // 消息是否允许转发 1：是（默认） 0：否
                callbackurl: "",
                sharetypename: "流程", //消息类型显示标题，没有则按sharetype显示
                opentype: 1, //移动端打开方式 1:app内打开（默认） 2：手机默认浏览器打开
                opentype_pc: 2, //PC端打开方式 1:应用内打开（默认） 2：PC默认浏览器打开
                sharetype: "workflow", // 分享数据类型："doc","workflow","task","pdoc","folder" ,"crm" 分别代表文档，流程，任务，云盘文档，云盘文件，客户名片
                shareid: val+"", // 分享的数据ID（必填）
            }
        )
        })
        this.props.CollectionListStore.shareParams = {
            "resourcetype": 152,
            "resourceid": selectedRowKeys.join(','),
        }
    }else{

      this.props.CollectionListStore.msgInfo =
        {
            'content': data.favname, // 分享标题（必填）
            'sysid': window.localStorage.emobile_ec_id, // EM中添加的集成系统的ID (必填: 按照demo给的传)
            'linkurl': data.url, // 消息链接地址（必填）
            'canforward': 1, // 消息是否允许转发 1：是（默认） 0：否
            'sharetypename': "流程", //消息类型显示标题，没有则按sharetype显示
            'opentype': 1, //移动端打开方式 1:app内打开（默认） 2：手机默认浏览器打开
            'opentype_pc': 2, //PC端打开方式 1:应用内打开（默认） 2：PC默认浏览器打开
            'sharetype': "", // 分享数据类型："doc","workflow","task","pdoc","folder" ,"crm" 分别代表文档，流程，任务，云盘文档，云盘文件，客户名片
            'shareid': data.favid+"", // 分享的数据ID（必填）
            "resourcetype":"37"
        }
      this.props.CollectionListStore.shareParams = {
          'url': '/api/common/chatResource/addshare',
          'resourcetype': "37",
          "resourceid": data.favid+"",
      }
    }

    this.props.CollectionListStore.browserConfig = {
        "extendTabs": [
            {
                "name": "",
                "key": "",
                "url":""
            }
        ]
    }
    this.props.history.push('/favouriteList/forward')
  }
  selectCancel = () => {
    const { CollectionListStore } = this.props;
    const { listAd, setState, showCheck } = CollectionListStore;
    const { listViewStore } = listAd
    setState({ showCheck: false })
    this.setState({ popoverShow: false }, console.log(this.state.popoverShow))
    listViewStore.selectNone()

  }
  onSelect = (v) => {
    const { CollectionListStore } = this.props;
    const { listAd, setState, showCheck } = CollectionListStore;
    this.setState({ selectKey: v, popoverShow: false })
    setState({ showCheck: true })

  }

  render() {
    const { CollectionListStore } = this.props;
    const { listAd, setState, showCheck, selectedDir, SearchAdvanced, moveSignal, layout,leftTreeValueArray } = CollectionListStore;
    const { str } = this.state
    const { searchAdvancedStore, listViewStore, leftTreeStore, searchParams } = listAd;
    const { selectedKeys, treeStore } = leftTreeStore
    const { datas } = treeStore
    const { history } = this.props;
    return (
      <div>
        <ListAdvanced className='favouriteList'
          getTemplate={(template) => { return ({ json: template1 }) }}
          store={listAd}
          hasAdvanceSerach
          selectedProps={getLabel('563', "数据")}
          withSwipeAction
          swipeActionProps={this.getSwipeActionProps()}
          rowKey="favid"
          searchKey="favname"
          treeKey="domid"
          onHideCheck={() => { this.selectCancel() }}
          conditionFetchOptions={{
            url: '/api/favourite/mobile/getConditions',
            method: 'POST',
          }}
          leftTreeFetchOptions={{
            url: '/api/favourite/mobile/getConditions',
            method: 'POST',
          }}
          searchBarProps={{
            placeholder: getLabel('32933', "请输入关键字"),
            showSelectButton: true,
            selectText: selectedDir,
            extraButton: [
              { key: 'advanced', show: <Icon key="filter-o" style={{ color: '#708090' }} type="filter-o" onClick={() => { this.testClick() }} /> },
              {
                key: 'drop', show: <Popover
                  overlayClassName="fortest"
                  visible={this.state.popoverShow}
                  overlay={[
                    (<Item key="4" value="scan" data-seed="logId" >{getLabel('-81455', "批量操作")}</Item>),
                  ]}
                  align={{
                    overflow: { adjustY: 20, adjustX: 0 },
                    offset: [0, 0],
                  }}
                  onSelect={(v) => { this.onSelect(v) }}
                >
                  <Icon key="ellipsis" style={{ color: '#708090' }} type="ellipsis" onClick={() => { this.setState({ popoverShow: true }) }} />
                </Popover>
              },
            ],

          }}
          leftTreeBrowserProps={{
            treeProps: {
              checkable: 3,
            },
            searchBarProps: {
              placeholder: getLabel('32933', "请输入关键字"),
              showExtraButton: true,

              extraButton: [
                {
                  key: 'build', show: <Popover
                    overlayClassName='newDir'
                    visible={this.state.newDirShow}
                    overlay={[
                      (<Button onClick={() => { this.handleClick() }}>{getLabel('20002', "新建目录")}</Button>),
                    ]}
                    align={{
                      overflow: { adjustY: 0, adjustX: 10 },
                      offset: [0, 5],
                    }}
                  >
                    {moveSignal ? <Icon type="ellipsis" /> : <div></div>}
                  </Popover>
                }
              ]
            },
            valueArray: toJS(leftTreeValueArray),
            onCleanUp: () => { setState({treeBtn:'clear'}) },
            onOk:()=>{
              setState({treeBtn:'sure'})
            }
          }}
          showCheck={showCheck}
          buttonGroupData={[
          //   {
          //   key: 'submit',
          //   text: getLabel('6011', "转发"),
          //   position: 'top',
          //   icon: 'share',
          //   className: "pink",
          //   onClick: () => {
          //     const { CollectionListStore } = this.props;
          //     const { listAd } = CollectionListStore;
          //     const { listViewStore } = listAd
          //     if (toJS(listViewStore.selectedRowKeys).length == 0) {
          //       Modal.alert('请至少选择一项')
          //     }else{
          //       // this.toHistory('/forward')
          //       this.setShareMsgInfo()
          //       // this.props.history.push("/favouriteList/forward")
          //     }
          //   },
          //   type: 'default',
          // },
          {
            key: 's',
            text: getLabel('78', "移动"),
            icon: 'move',
            className: "pink",
            onClick: () => { this.move() },
            type: 'default',
          }, {
            key: 'ss',
            text: getLabel('18178', "重要程度"),
            icon: 'blog-weitijiao',
            className: "pink",
            onClick: () => {
              if (listViewStore.selectedRowKeys.length != 0) {
                this.setState({ visible: true })
                // listViewStore.selectNone()
              } else {
                Modal.alert(getLabel('390910', "请至少选择一项!"))
              }
            },
            type: 'default',
          }, {
            key: 'sss',
            text: getLabel('91', "删除"),
            icon: 'delete',
            className: "pink",
            onClick: () => this.delete(),
            type: 'default',
          }]}
          onSearch={this.onSearch}
          onLeftTreeChange={this.onLeftTreeChange}
          onRowClick={(dd) => {
            const { listViewStore } = listAd;
            let { selectedRowKeys = [] } = listViewStore;
            if (showCheck) {
              if (selectedRowKeys.includes(dd.randomFieldId)) {
                selectedRowKeys.splice(selectedRowKeys.indexOf(dd.randomFieldId), 1)
                listViewStore.setState({ selectedRowKeys })
              } else {
                listViewStore.setState({ selectedRowKeys: [...selectedRowKeys, dd.randomFieldId] })
              };
            } else {
              this.props.CollectionListStore.moveId = dd.favid
              if(dd.mobileurlspan!==""){
                // window.open(dd.mobileurlspan,"_self")
                //window.location.href=dd.mobileurlspan
                window.openLink(dd.mobileurlspan,"href");
              }
            }

            // let path = {
            //   pathname: '/detailPage',
            //   state: dd,
            // }

          }}
        />
        <Route
          key={layout.id}
          path={layout.path}
          render={() => (
            <RouteLayout>
              <div
                key="wmPoutePageDemo"
                className="wm-route-layout wm-demo-route-layout-page"
              >
                <DetailPage />
              </div>
            </RouteLayout>
          )}
        />
        <Route
          key={'share'}
          path={"/favouriteList/forward"}
          render={() => (
            <RouteLayout>
              <div
                key="share"
                className="wm-route-layout wm-demo-route-layout-page"
              >{showCheck?<Share
                msgList={CollectionListStore.msgList}
                shareParams={CollectionListStore.shareParams}
                store={CollectionListStore.share}/>:<Share
                msgList={CollectionListStore.msgInfo}
                shareParams={CollectionListStore.shareParams}
                store={CollectionListStore.share}/>}

              </div>
            </RouteLayout>
          )}
        />
        <Picker
          visible={this.state.visible}
          data={seasons}
          cascade={false}
          extra=""
          value={this.state.sValue}
          onOk={v => {
            let that = this
            this.setState({ sValue: v, visible: false })
            const { CollectionListStore } = this.props;
            const { listAd } = CollectionListStore;
            const { searchAdvancedStore, listViewStore, searchParams } = listAd;
            setState({ showCheck: false })
            let selectedKeys = toJS(listViewStore.selectedRowKeys)
            selectedKeys = selectedKeys.join(',')
            const options = {
              url: '/api/sysfavourite/editLevel',
              method: 'POST',
              params: { favid: selectedKeys, importlevel: v },
              type: 'json',
            };
            Tools.callApi(options).then((src) => {
              const { formParams } = searchAdvancedStore.form;
              let params = { ...formParams };
              listViewStore.clearData();
              listAd.getData({ url: '/api/favourite/mobile/getFavouriteList', method: 'post', params });
              listViewStore.selectNone()
            })


          }}
          onDismiss={() => this.setState({ visible: false })}
        />



      </div>
    );
  }
}